package tx.demo03;

/**
 * @author lwj
 * @date 2025-03-13
 * @vesion 1.0.0
 */
public class MyThread extends Thread{
    /**
     * 锁对象
     */
    public static final String LOCK = "";


    @Override
    public void run() {
        synchronized (LOCK){
            try {
                // 线程等待 - wait方法释放锁对象
                // LOCK.wait(5000);

                // 线程等待 - sleep方法不释放锁对象
                Thread.sleep(5000);

                System.out.println("唤醒子线程，执行相关的业务代码...");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
